EXECUTABLE=Exe/MyRobot

CSRC = $(wildcard *.c) $(wildcard Actuators/*.c) $(wildcard Blobs/*.c) $(wildcard Captors/*.c) $(wildcard DataManager/*.c) $(wildcard Tools/*.c)
CINCS = -I./ -I./Actuators -I./Blobs -I./Captors -I./DataManager -I./Tools
CFLAGS = -c -Wall -g

CPPSRC = $(wildcard *.cpp) $(wildcard Actuators/*.cpp) $(wildcard Blobs/*.cpp) $(wildcard Captors/*.cpp) $(wildcard DataManager/*.cpp) $(wildcard Tools/*.cpp)
CPPINCS = -I./ -I./Actuators/ -I./Blobs/ -I./Captors/ -I./DataManager -I./Tools
CPPFLAGS = -c -Wall -g

CC = gcc
CPP = g++

LDFLAGS = -L/usr/lib/ -lboost_thread -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_objdetect -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_contrib -lopencv_flann -lopencv_gpu -lopencv_legacy -lopencv_ml -lopencv_photo -lopencv_stitching -lopencv_ts -lopencv_videostab

OBJECTS = $(CSRC:.c=.o) $(CPPSRC:.cpp=.o)

all: $(SOURCES) $(EXECUTABLE)
	
$(EXECUTABLE): $(OBJECTS) 
	$(CPP) $(LDFLAGS) $(OBJECTS) -o $@

# Compile: create object files from C source files.
.c.o:
	$(CC) $(CFLAGS) $(CINCS) $< -o $@ 

# Compile: create object files from C++ source files.
.cpp.o:
	$(CPP) $(CPPFLAGS) $(CPPINCS) $< -o $@ 

clean:
	rm -rf *o  Actuators/*o Blobs/*o Captors/*o DataManager/*o $(EXECUTABLE)
	
